//
// ColorChannelSwapper.glsl
// ColorChannelSwapper
//
// Copyright (C) 2010
// Julius Parishy
//

uniform sampler2D webcam_texture;

uniform float elapsed_time;
uniform int color_channel;

void main()
{
	vec2 coord = gl_TexCoord[0].st;
	vec4 color = texture2D(webcam_texture, coord.st);
	
	float temp = 0.0;

	if(color_channel == 0)
	{
		color.r = 1.0 - color.r;
	}
	else if(color_channel == 1)
	{
		color.g = 1.0 - color.g;	
	}
	else if(color_channel == 2)
	{
		color.b = 1.0 - color.b;
	}
	else if(color_channel == 3)
	{
		float t = color.g;
		color.r = 1.0 - color.b;
		color.g = 1.0 - color.r;
		color.b = 1.0 - t;
	}

	gl_FragColor = color;
}
